-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't copy an immutable digraph when adding zero vertices #346
Don't copy an immutable digraph when adding zero vertices #346
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the manual entry needs to be amended to note that the returned graph is not copied if 0 new nodes are added. Since I think this PR changes the behaviour, it's not inconceivable that there's code out there (or in here) that relies on the old behaviour.
8e55500
to
5041f15
Compare
I have updated the manual entry for |
5041f15
to
a081ee0
Compare
{D, labels} -> MakeImmutable(DigraphAddVertices(DigraphMutableCopy(D), | ||
labels))); | ||
function(D, labels) | ||
if IsEmpty(labels) then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know you didn't name this in your PR, but why is the argument named labels
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because this method adds Length(labels)
new vertices, where the i
th vertex to be added is given the label labels[i]
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, thanks!
b654260
to
e3b42a7
Compare
Codecov Report
@@ Coverage Diff @@
## stable-1.3 #346 +/- ##
===========================================
Coverage 95.25% 95.25%
===========================================
Files 49 49
Lines 12352 12359 +7
===========================================
+ Hits 11766 11773 +7
Misses 586 586
|
Can you please rebase onto stable-1.3, and then I'll merge @wilfwilson ? |
e3b42a7
to
6c86d96
Compare
This is similar to #338 and #340, for edges (although I made these changes over a year ago!).